package com.charmzenus.champion.ui.fragment.main;

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;

import com.charmzenus.champion.R;
import com.charmzenus.champion.base.BaseFragment;
import com.charmzenus.champion.dagger.component.fragment.main.DaggerMainOrderFragmentComponent;
import com.charmzenus.champion.dagger.module.fragment.main.MainOrderFragmentModule;
import com.charmzenus.champion.presenter.fragment.main.MainOrderFragmentPresenter;
import com.scwang.smartrefresh.layout.api.RefreshLayout;

import javax.inject.Inject;


/**
 * 主页，订单
 */
public class MainOrder extends BaseFragment {

    @Inject
    MainOrderFragmentPresenter presenter;
    private RefreshLayout refreshLayout;
    private RecyclerView recyclerView;


    @Override
    protected void initBeforeActivityCreated() {
        super.initBeforeActivityCreated();
        DaggerMainOrderFragmentComponent component = (DaggerMainOrderFragmentComponent) DaggerMainOrderFragmentComponent
                .builder()
                .mainOrderFragmentModule(new MainOrderFragmentModule(this))
                .build();
        component.in(this);
    }

    @Override
    public View createSuccessView() {
        return LayoutInflater.from(getContext()).inflate(R.layout.fragment_main_order, null, false);
    }


    @Override
    protected void load() {
        showPageSuccess();
    }

    @Override
    protected void initView() {
        refreshLayout = mView.findViewById(R.id.refreshLayout);
        recyclerView = mView.findViewById(R.id.main_order_recyclerView);
        presenter.initRefreshLayout();
    }

    public RefreshLayout getRefreshLayout() {
        return refreshLayout;
    }

    public RecyclerView getRecyclerView() {
        return recyclerView;
    }
}
